<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Credit extends CI_Controller {
	public function __construct()
	{
		parent::__construct();
		
		switch ($this->router->method)
		{
			case 'index':
			case 'create':
			case 'change':
				if ( ! $this->auth->is_logged_in())
				{
					redirect();
				}
			break;
		}
	}

	public function index()
	{
		$this->template->set('breadcrumbs', array(
			array(
				'url' => '',
				'name' => 'Kredyty'
			)
		));
		
		$this->load->model('credits');
		
		$credits = $this->credits->get_all($this->auth->data('id'));
		$this->template->set('credits', $credits);
		
		$this->template->render();
	}
	
	public function create()
	{
		$this->load->helper('form');
		$this->template->set('breadcrumbs', array(
			array(
				'url' => site_url('credit'),
				'name' => 'Kredyty'
			),
			array(
				'url' => '',
				'name' => 'Tworzenie'
			)
		));
		$this->template->render();
	}
	
	public function change($approve)
	{
		$this->template->set('breadcrumbs', array(
			array(
				'url' => site_url('credit'),
				'name' => 'Kredyty'
			),
			array(
				'url' => '',
				'name' => 'Zarządzanie'
			)
		));
		$this->template->render();
	}
}

/* End of file credits.php */
/* Location: ./application/controllers/credits.php */
